// Password.h: interface for the CPassword class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PASSWORD_H__703D082A_19F8_4D33_AF6D_5FDDAA8B0129__INCLUDED_)
#define AFX_PASSWORD_H__703D082A_19F8_4D33_AF6D_5FDDAA8B0129__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PasswordV.h"

class CPassword
	: public CPasswordV
{
// Interface
public:
	enum EPasswordType
	{
		PWD_UNKOWN,
		PWD_STATICAL
	};
	const EPasswordType GetType();
	bool SetStaticPassword(const char* const pszPassword);
	virtual const char* const GetStaticPassword() const;
	bool SetDeadline(const COleDateTime& dtDeadline);
	const COleDateTime* const GetDeadline() const;
	bool SetLimitedTimes(const UINT& nTimes);
	const UINT GetLeftTimes() const;
	bool IsPastDue() const;
	virtual void Remove();
	UINT GetID();
	const EAuthResult Authenticate(const char* const pszPassword);

// Construction/Destruction
public:
	CPassword(const UINT nPasswordID =0);
	virtual ~CPassword();

// Data
private:
	EPasswordType m_type;
	CPasswordV* m_pPassword;
	CLimitation* m_pLimitation;

// Implement
protected:
	virtual void OnNew(CADORecordset* pRS);
	virtual inline void Load();
	virtual void MakeInValid();
private:
	static const CString KPassword;
	static const CString Type;
	static const CString LimitationID;

	inline void Instance(const EPasswordType& type);
	inline void InstanceRealPassword();
	inline void LoadLimitation(const UINT& nLimitationID);

	inline void SavePassword();
	inline void SaveLimitationID(const UINT& nLimitationID);
	inline void SetType(const EPasswordType& type);

	void HandlePassAuthentication();
};

#endif // !defined(AFX_PASSWORD_H__703D082A_19F8_4D33_AF6D_5FDDAA8B0129__INCLUDED_)
